package com.kim.logs.core.builders;

import com.kim.logs.core.provider.EsAppendeServiceManager;
import com.kim.logs.core.provider.LogAppenderService;
import org.zxp.esclientrhl.repository.ElasticsearchTemplate;

public class EsServiceBuilder extends LoggerAppenderServiceBuilder {

    private ElasticsearchTemplate elasticsearchTemplate;
    private String sysCode;

    public EsServiceBuilder sysCode(String sysCode) {
        this.sysCode = sysCode;
        return this;
    }

    public String getSysCode() {
        return sysCode;
    }


    public EsServiceBuilder(ElasticsearchTemplate elasticsearchTemplate) {
        super();
        this.elasticsearchTemplate = elasticsearchTemplate;
    }

    public ElasticsearchTemplate getJdbcTemplate() {
        return elasticsearchTemplate;
    }

    public void setJdbcTemplate(ElasticsearchTemplate elasticsearchTemplate) {
        if (null != this.elasticsearchTemplate) {
            return;
        }
        this.elasticsearchTemplate = elasticsearchTemplate;
    }

    /**
     * 开始构建
     *
     * @return 商户列表服务·
     */
    @Override
    protected LogAppenderService performBuild() {
        return new EsAppendeServiceManager(elasticsearchTemplate, sysCode);
    }
}
